package simplefactory;


import bean.NormalShoes;
import bean.Shoes;
import bean.SportShoes;

/**
 * Title: simplefactory.ShoesFactory <br>
 * Description: 简单工厂案例<br>
 * Copyright (c) 传化物流版权所有 2017 <br>
 * Created DateTime: 2017-3-6 9:58
 * Created by Wentao.Shi.
 */
public class ShoesFactory {
    public static final int SHOES_TYPE_NORMAL = 1;
    public static final int SHOES_TYPE_SPORT  = 2;

    public static Shoes createShoes(int type) {
        //随着种类增多，这里要经常改变
        Shoes result = null;
        switch (type) {
            case SHOES_TYPE_NORMAL:
                result = new NormalShoes();
                break;
            case SHOES_TYPE_SPORT:
                result = new SportShoes();
                break;
            default:
                result = new NormalShoes();
                break;
        }
        return result;
    }

}
